package com.sprint.controller;

import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.client.RestTemplate;

import javax.annotation.Resource;

@RestController
@Slf4j
public class ConsumerConsulController {
    private final String SERVER_URL = "http://consul-provider-payment";
    @Value("${server.port}")
    private String serverPort  ;
    @Resource
    private RestTemplate restTemplate;

    @GetMapping("/consumer/payment/consul")
    public String getPamentConsul(){
        log.info("*******************" + SERVER_URL+"/payment/consul" );
        return restTemplate.getForObject(SERVER_URL+"/payment/consul",String.class);
    }
}
